package org.flower.mapper;

import org.apache.ibatis.annotations.Param;
import org.flower.bean.CommodityDetails;
import org.flower.bean.Order;
import org.flower.bean.OrderExample;

import java.util.List;

/**
 * @author Aizen
 * @date 2021/12/24
 */
public interface OrderMapper {

    /**
     * 查所有订单
     *
     * @param order 订单
     * @return {@link List}<{@link Order}>
     */
    List<Order> getAllOrder(Order order);

    /**
     * 根据ID找到订单
     *
     * @param id id
     * @return {@link Order}
     */
    Order findOrderById(String id);

    /**
     * 找到订单细节的id
     *
     * @param id id
     * @return {@link List}<{@link CommodityDetails}>
     */
    List<CommodityDetails> findOrderDetailById(String id);


    /**
     * 更新订单
     *
     * @param order 订单
     * @return boolean
     */
    boolean updateOrder(Order order);


    int countByExample(OrderExample example);

    int deleteByExample(OrderExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Order record);

    int insertSelective(Order record);

    List<Order> selectByExample(OrderExample example);

    Order selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Order record, @Param("example") OrderExample example);

    int updateByExample(@Param("record") Order record, @Param("example") OrderExample example);

    int updateByPrimaryKeySelective(Order record);

    int updateByPrimaryKey(Order record);
}